package acm.蓝桥20;

import java.util.Scanner;

public class A数学题 {
	static int maxn = (int) 2e5 + 10, maxa = 1000;
	static int n;
	static long[] arr = new long[maxn];

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		long sum = 0;
		for (int i = 1; i <= n; i++) {
			arr[i] = sc.nextInt();
			sum += arr[i];
		}
		long res = 0;
		for (int i = 1; i <= n; i++) {
			sum-=arr[i];
			res+=arr[i]*sum;
		}
		System.out.println(res);
	}
}
